<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/views/include/taglib.jsp" %>
<html>
<head>
    <title>部署流程 - 流程管理</title>
    <meta name="decorator" content="form"/>

</head>
<body style="background: white;">
<sys:message content="${message}"/>

<div class="form-body" style="padding: 30px">
    <form:form id="inputForm" action="${ctx}/act/process/deploy" method="post" enctype="multipart/form-data"
               cssStyle="padding: 5px;"
               class="form-horizontal">
        <div class="control-group">
            <label class="control-label">流程分类：</label>
            <div class="controls">
                <select id="category" name="category" class="required form-control">
                    <c:forEach items="${fns:getDictList('act_category')}" var="dict">
                        <option value="${dict.value}">${dict.label}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">流程文件：</label>
            <div class="controls">
                <input type="file" id="file" name="file" class="required form-control"/>
                <span class="help-inline">支持文件格式：zip、bar、bpmn、bpmn20.xml</span>
            </div>
        </div>
    </form:form>
</div>

<%@include file="/views/include/foot.jsp" %>
<script type="text/javascript">
    var validateForm;
    function doSubmit() { // 回调函数，在编辑和保存动作时，供openDialog调用提交表单。
        if (validateForm.form()) {
            $("#inputForm").submit();
            return true;
        }
        return false;
    }

    $(document).ready(function () {
        validateForm = $("#inputForm").validate({
            errorElement: 'span',
            errorClass: 'help-inline border-red font-red',
            focusInvalid: false,
            errorContainer: "#messageBox",

            submitHandler: function (form) {
                loading('正在提交，请稍等...');
                form.submit();
            },
            errorPlacement: function (error, element) {
                $("#messageBox").text("输入有误，请先更正");
                if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                    error.appendTo(element.parent().parent());
                } else {
                    error.insertAfter(element);
                }
            }
        });
    });
</script>
</body>
</html>
